package cn.sccl.common.web;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.support.WebApplicationContextUtils;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

/**
 * wangping 2016-02-25 迁移代码时注释
 * import cn.sccl.common.web.util.Log4jWebConfigurer;
 */

/**
 * wangping 2016-02-25 迁移代码时注释
 * import cn.sccl.common.web.util.Log4jWebConfigurer;
 */

/**
 * *******************************
 *
 * @ClassName: StartupListener.java
 * @author: bieby
 * @createdAt: 2014-2-12上午10:12:12
 * *********************************
 */
public class StartupListener extends ContextLoaderListener implements ServletContextListener {
    /**
     * 日志
     **/
    private final Log log = LogFactory.getLog(getClass());


    @Override
    public void contextInitialized(ServletContextEvent event) {
        super.contextInitialized(event);
        log.debug("contextInitialized");
        ServletContext context = event.getServletContext();
        setupContext(context);

        // init : location of the log4j config file & refresh interval for
        // checking the log4j config
        /**
         * wangping 2016-02-25 迁移代码时注释
         Log4jWebConfigurer.initLogging(event.getServletContext());
         */
    }

    /**
     * @param context context
     * @Title: setupContext
     * @Description: 初始化上下文环境
     * @Author: bieby
     * @Date: 2014-2-12
     */
    protected void setupContext(final ServletContext context) {
        ApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(context);

    }


    @Override
    public void contextDestroyed(ServletContextEvent event) {

    }

}
